package gemini.castor.ui.client.page.content.store.shoppingcart.cartsummary;

import gemini.castor.ui.client.page.content.store.shoppingcart.ShoppingCartItem;

import com.google.gwt.event.shared.GwtEvent;

/**
 * The event collections of internal widget for screen uk 1-21.010-a
 */
public class ShoppingCartSummaryEvent extends GwtEvent<ShoppingCartSummaryHandler> {

	private static Type<ShoppingCartSummaryHandler> TYPE;

	public static Type<ShoppingCartSummaryHandler> getType() {
		if (TYPE == null)
			TYPE = new Type<ShoppingCartSummaryHandler>();
		return TYPE;
	}
	
	private ShoppingCartItem item;
	
	public ShoppingCartSummaryEvent(ShoppingCartItem item){
		this.item = item;
	}

	@Override
	protected void dispatch(ShoppingCartSummaryHandler handler) {
		handler.onItemsChanged(this);
	}

	@Override
	public Type<ShoppingCartSummaryHandler> getAssociatedType() {
		return getType();
	}

	public ShoppingCartItem getItem() {
		return item;
	}
}
